package com.gen.tool;

import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
//import android.view.Window;
//import android.view.WindowManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

import com.ouken.com.R;
import com.ouken.com.RoomlistActivity;

public class AlertDialog_password{
	private Context context;
	private String msg;
	
	private LayoutInflater factory;
	final View show_ok;
	private Button confirm_btn_ok;
	private Button cancel_btn_can;
	private TextView text;
	private Dialog alertDialog;
	private EditText ev_pwd;
	
	public AlertDialog_password(final Context context,String msg) {
		super();
		this.context = context;
		this.msg = msg;
		
		this.factory = LayoutInflater.from(context); 
		this.show_ok = factory.inflate(R.layout.alert_dialog_password, null);
		this.confirm_btn_ok = (Button) show_ok.findViewById(R.id.alerDialog_password_con_btn);
		this.cancel_btn_can = (Button) show_ok.findViewById(R.id.alerDialog_password_can_btn);
		this.text =   (TextView) show_ok.findViewById(R.id.alerDialog_password_tv_msg);
		this.ev_pwd = (EditText)show_ok.findViewById(R.id.alerDialog_password_tv_password);
		
		ev_pwd.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View v) {
				((InputMethodManager)context.getSystemService(Context.INPUT_METHOD_SERVICE)).showSoftInput(show_ok, 0);
				((InputMethodManager)context.getSystemService(Context.INPUT_METHOD_SERVICE)).toggleSoftInput(0,
					     InputMethodManager.HIDE_NOT_ALWAYS);
				System.out.println("OKOKOKO");
			}
		});
		
		
	}
	
	public Dialog AlertDialog_ok_cancel_show(){
		this.text.setText(msg);
		this.text.setTextSize(18.0f);
		this.alertDialog = new AlertDialog.Builder(this.context).create();
		
		alertDialog.setCancelable(false);
	    alertDialog.show();
	    alertDialog.setContentView(show_ok);
	    
		//((InputMethodManager)context.getSystemService(INPUT_METHOD_SERVICE)).showInputMethodPicker();
		
	    
	    return this.alertDialog;
	}
	
	public Button getConfirm_btn_ok() {
		return confirm_btn_ok;
	}

	public Button getCancel_btn_can() {
		return cancel_btn_can;
	}

	
	public EditText getEv_pwd() {
		return ev_pwd;
	}



	public Dialog getAlertDialog() {
		return alertDialog;
	}

}